package io.github.frailty9.crserver.model

import java.time.LocalDateTime
import com.mybatisflex.annotation.Column
import com.mybatisflex.annotation.Id

/**
 * 预约记录表
 */
data class Reservation(
    @Id
    override var id: Long? = null,
    /**
     * 用户 account.id
     */
    var userId: Long? = null,
    /**
     * 资源 resource.id
     */
    var resourceId: Long? = null,
    /**
     * 关联 resource_instance.id
     */
    var instanceId: Long? = null,
    /**
     * 预约单位数（1=半场，2=全场）
     */
    var unitsBooked: Int? = null,
    /**
     * 0=已取消，1=已预约，2=已签到，3=已过期，4=违约
     */
    var status: Int? = null,
    /**
     * 签到时间
     */
    var checkInTime: LocalDateTime? = null,

    @Column(version = true)
    override var version: Int? = null,

    @Column(onInsertValue = "CURRENT_TIMESTAMP")
    var createTime: LocalDateTime? = null,

    @Column(onInsertValue = "CURRENT_TIMESTAMP", onUpdateValue = "CURRENT_TIMESTAMP")
    var updateTime: LocalDateTime? = null,

    @Column(isLogicDelete = true)
    override var deleted: Int? = null
) : BaseModel
